package com.hskj.springboot.bean;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;
@Data
@Component //做的是自动映射数据，所以要将数据交给容器
//@ConfigurationProperties(prefix = "person") //实体类与yml有个映射关系
public class Person implements InitializingBean {

    @Value("${person.lastname}")
    private String lastName;
    @Value("${person.age}")
    private Integer age;
    @Value("${person.boss}")
    private Boolean boss;
    private Date birth;

    private Map<String, Object> maps;
    private List<Object> lists;
    private Dog dog;

    //这个变量是对外提供的一个名称
    public static String LAST_NAME;
    public static Integer AGE;


    @Override
    public void afterPropertiesSet() throws Exception {
        LAST_NAME=lastName;
        AGE=age;
    }
}